package com.thread;

//线程的优先级
public class PriorityDemo {
    public static void main(String[] args) {
        Thread max = new Thread() {
            public void run() {
                for (int i = 0; i < 10000; i++) {
                    System.out.println("max");
                }
            }
        };

        Thread min = new Thread() {
            public void run() {
                for (int i = 0; i < 10000; i++) {
                    System.out.println("min");
                }
            }
        };

        Thread def = new Thread() {
            public void run(){
                for (int i = 0; i < 10000; i++) {
                    System.out.println("def");
                }
            }
        };

        max.setPriority(Thread.MAX_PRIORITY);//最大尺度线程
        min.setPriority(Thread.MIN_PRIORITY);//最小尺度线程
        max.setPriority(Thread.NORM_PRIORITY);//默认也是这个值

        max.start();
        min.start();
        def.start();
    }
}
